package net.oschina.app.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import net.oschina.app.R;
import net.oschina.app.ui.widget.FaceFactoty;

/**
 * Created by foty on 2017/4/8.
 * ?
 */

public class DialogFaceAdapter extends BaseRecyclerViewAdapter {

    private final FaceFactoty mFace;

    public DialogFaceAdapter(Context context) {
        super(context);
        mFace = new FaceFactoty();
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(parent.getContext(), R.layout.face_item_rcv,null);
        MyFaceHolder holder = new MyFaceHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        MyFaceHolder faceHolder = (MyFaceHolder) holder;
        faceHolder.mFace.setImageResource(mFace.getFaceID(""));
    }

    @Override
    public int getItemCount() {
        return 35;
    }

    class MyFaceHolder extends RecyclerView.ViewHolder{
        ImageView mFace;
        public MyFaceHolder(View itemView) {
            super(itemView);
            mFace = (ImageView) itemView.findViewById(R.id.face_item_img);
        }
    }
}
